<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib uri="http://www.ecside.org" prefix="ec"%>
<jsp:useBean id="pageBean" scope="request" class="com.agileai.hotweb.domain.PageBean"/>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>任务列表</title>
<%@include file="/jsp/inc/resource.inc.jsp"%>
</head>
<style>
#select-dev-people{
	background-color: rgb(249, 249, 249);
    border: 1px solid #d9d9d9;
    border-color: #20548A;
    border-radius: 5px 5px 0 0;
    width: 15%;
    float: left;
    text-align: left;
    margin-top: 10px;
    overflow:auto;
    height: 520px;
}
ul{
    list-style: none;
    margin-left: -30px;
}
#overall-box{
    width: 84%;
    float: right;
}
#list-content{
    
}
label:hover{
cursor:point
}
.queryTable {
 
}
#testPlan{
   margin-left: 11px;
}
#__ToolBar__{
}
.select-role{
	background: url(../aeaipm/images/decorator/bg2.gif) repeat-x;
	height: 28px;
    line-height: 28px;
    color: white;
    margin-top: 0px;
    text-align: left;
    overflow: hidden;
    font-size: 12px;
}
.heidden-div{
	display: none;
}
.show-div{
	width: 100% !important;
}
#checkboxDiv input{
vertical-align: middle;
}
</style>
<body>
<form action="<%=pageBean.getHandlerURL()%>" name="form1" id="form1" method="post">
<%@include file="/jsp/inc/message.inc.jsp"%>
  
	<div id="select-dev-people"  > 
				<h3 class="select-role">&nbsp;&nbsp;测试方案</h3>
				<div style="margin-left:10px"><select id="testPlan" name="testPlan" onchange="doQuery()"><%=pageBean.selectValue("testPlan") %></select></div>
				
				<div id="checkboxDiv" style="margin-left:20px;display:none">
				<input id="checkAll" type="checkbox" />&nbsp;全选择
				<%=pageBean.selectCheckBox("tpdState")%>
				</div>
	</div>

<div id="overall-box" >
	<div id="__ToolBar__">
	<table class="toolTable" border="0" cellpadding="0" cellspacing="1">
	<tr>
	   <td onmouseover="onMover(this);" onmouseout="onMout(this);" class="bartdx" hotKey="D" align="center" onclick="deleteDates()"><input value="&nbsp;" title="删除" type="button" id="delImgBtn" class="delImgBtn" />删除</td>
	   <td onmouseover="onMover(this);" onmouseout="onMout(this);" class="bartdx" hotKey="D" align="center" onclick="openEditPage();"><input value="&nbsp;" title="查看" type="button" class="detailImgBtn" />查看</td> 
	</tr>
	</table>
	</div>
	<div id="__ParamBar__">
	<table class="queryTable">
		<tr><td>
		&nbsp;所属功能<input readonly="readonly" id="pfNames" label="所属功能" name="pfNames" type="text" value="<%=pageBean.inputValue("pfNames")%>" size="40" class="text" />
		<input id="pfIds" label="所属功能" name="pfIds" type="hidden" value="<%=pageBean.inputValue("pfIds")%>" size="40" class="text" />
		<img id="grpIdSelectImage" src="images/sta.gif" width="16" height="16" onclick="openTreeFunction()"/>
		&nbsp;<a onclick="clearPfids()">清空</a>
		</td></tr>
		<tr><td colspan="2">
		<%-- &nbsp;当前处理人<input id="tdoHandler" label="当前处理人" name="tdoHandler" type="text" value="<%=pageBean.inputValue("tdoHandler")%>" size="7" class="text" /> --%>  
		&nbsp;处理人员<input id="properson" label="处理人" name="properson" type="text" value="<%=pageBean.inputValue("properson")%>" size="7" class="text" />
		
		&nbsp;测试人员<input id="testPerson" label="测试人员" name="testPerson" type="text" value="<%=pageBean.inputValue("testPerson")%>" size="7" class="text" />
		
		&nbsp;缺陷名称<input id="tpdName" label="缺陷名称" name="tpdName" type="text" value="<%=pageBean.inputValue("tpdName")%>" size="12" class="text" />
		
		<%-- &nbsp;所属功能<input id="pfName" label="所属功能" name="pfName" type="text" value="<%=pageBean.inputValue("pfName")%>" size="7" class="text" /> --%>
		
		&nbsp;优先级<select id="tpdPriority" label="优先级" name="tpdPriority" class="select" onchange="doQuery()"><%=pageBean.selectValue("tpdPriority")%></select>
		
		</td></tr>
		<tr><td>
		&nbsp;发布时间<input id="releaseTimeStart" label="发布时间" name="releaseTimeStart" type="text" value="<%=pageBean.inputDate("releaseTimeStart")%>" size="7" class="text" /><img id="releaseTimeStartPicker" src="images/calendar.gif" width="16" height="16" alt="日期/时间选择框" />
		-<input id="releaseTimeEnd" label="发布时间" name="releaseTimeEnd" type="text" value="<%=pageBean.inputDate("releaseTimeEnd")%>" size="7" class="text" /><img id="releaseTimeEndPicker" src="images/calendar.gif" width="16" height="16" alt="日期/时间选择框" />
		
		&nbsp;处理时间<input id="processTimeStart" label="处理时间" name="processTimeStart" type="text" value="<%=pageBean.inputDate("processTimeStart")%>" size="7" class="text" /><img id="processTimeStartPicker" src="images/calendar.gif" width="16" height="16" alt="日期/时间选择框" />
		-<input id="processTimeEnd" label="处理时间" name="processTimeEnd" type="text" value="<%=pageBean.inputDate("processTimeEnd")%>" size="7" class="text" /><img id="processTimeEndPicker" src="images/calendar.gif" width="16" height="16" alt="日期/时间选择框" />
		
		&nbsp;缺陷类型<select id="tpdType" label="缺陷类型" name="tpdType" class="select" onchange="doQuery()"><%=pageBean.selectValue("tpdType")%></select>
		&nbsp;<input type="button" name="button" id="button" value="查询" class="formbutton" onclick="doQuery()" />
		</td>
		</tr>
		</table>
	</div>

	<div id="list-content">
		<ec:table 
		form="form1"
		var="row"
		items="pageBean.rsList" csvFileName="任务列表.csv"
		retrieveRowsCallback="process" xlsFileName="任务列表.xls"
		useAjax="true" sortable="true"
		doPreload="false" toolbarContent="navigation|pagejump |pagesize |export|extend|status"
		width="100%" rowsDisplayed="15"
		listWidth="100%" 
		height="390px"
		>
		<ec:row styleClass="odd" ondblclick="openEditPage();" oncontextmenu="selectRow(this,{TPD_ID:'${row.TPD_ID}'});refreshConextmenu()" onclick="selectRow(this,{TPD_ID:'${row.TPD_ID}'});setTpdId('${row.TPD_ID}');selectedCheck('${GLOBALROWCOUNT}')">
			<ec:column width="25" style="text-align:center" property="TPD_ID" cell="checkbox" headerCell="checkbox" onclick="$(this).parents('tr').trigger('click');"/>
			<ec:column width="50" style="text-align:center" property="_0" title="序号" value="${GLOBALROWCOUNT}" />
			<ec:column width="80" property="PF_NAME" title="所属功能"   />
			<ec:column width="80" property="TPD_NAME" title="缺陷名称"   />
			<ec:column width="100" property="TPD_RELEASE_TIME" title="发布时间"   />
			<ec:column width="100" property="TPD_PROCESS_TIME" title="处理时间" cell="date" format="yyyy-MM-dd HH:mm" />
			<ec:column width="100" property="TPD_STATE" title="当前状态"   mappingItem="TPD_STATE"/>
			<ec:column width="100" property="TPD_TESTPERSON_NAME" title="测试人员"   />
			<ec:column width="100" property="TPD_PROPERSON_NAME" title="处理人员"   />
			<ec:column width="100" property="TPD_TYPE" title="缺陷类型"   mappingItem="TPD_TYPE"/>
			<%-- <%-- <ec:column width="100" property="TPD_TYPE_NAME" title="缺陷类型"   mappingItem="TPD_TYPE_NAME"/> --%> --%>
			<ec:column width="100" property="TPD_PRIORITY" title="优先级"   mappingItem="TPD_PRIORITY"/>
		</ec:row>
		</ec:table>
	</div>
</div>
<input type="hidden" name="tpdId" id="tpdId" value="" />
<input type="hidden" name="TPD_ID" id="TPD_ID" value="" />
<input type="hidden" name="actionType" id="actionType" />
<input type="hidden" id="ids" name="ids" value="<%=pageBean.inputValue("ids")%>" />
<script language="JavaScript">
var fontColor = {
		  "ACKNOWLEDGEMENT":"#7030A0",
		  "DISTRIBBTION":"#FFC000",
		  "EVALUATE":"#0070C0",
		  "INITIALIZE":"black",
		  "PROPOSE":"#FF0000",
		  "RECOGNITION":"#00B050",
		  "REJECTS":"black",
		  "RESOVE":"#00B0F0",
		  "ABANDONED":"#BFBFBF"
		};

$(function(){
	
	var a = $('#checkboxDiv').contents().filter(function() {
		  return this.nodeType == 3;
	}).wrap("<span></span>");
	$("#checkboxDiv input").each(function(){
		var nextNode = $(this).next();
		$(this).wrap("<p></p>");
		var parentNode = $(this).parent();
		nextNode.appendTo(parentNode);

		var boxVal = $(this).val();
		nextNode.css("color",fontColor[boxVal]);
	});
	$("#checkboxDiv").show();
	
	$("#checkAll").attr("checked",$("input[name='tpdState']").length == $("input[name='tpdState']:checked").length ? true : false);
	$("#checkAll").click(function() {
        $('input[name="tpdState"]').attr("checked",this.checked); 
    });
    var $subBox = $("input[name='tpdState']");
    $subBox.click(function(){
        $("#checkAll").attr("checked",$subBox.length == $("input[name='tpdState']:checked").length ? true : false);
    });
    
    $("input[name='tpdState']").change(function() { 
    	doQuery();
    	});
    $("#checkAll").change(function() { 
    	doQuery();
    	});
	if("INITIALIZE"!="<%=pageBean.inputValue("ptState")%>"){
		disableButton("delImgBtn");
	}
})

function selectedCheck(indexId){
	
	var idInt = parseInt(indexId);
	var currentIndexId = idInt ;
	if($("#ec_table tr:eq("+currentIndexId+") input[name = 'TPD_ID']").is(':checked')){
		$("#ec_table tr:eq("+currentIndexId+") input[name = 'TPD_ID']").attr('checked',false);
	}else{
		$("#ec_table tr:eq("+currentIndexId+") input[name = 'TPD_ID']").attr('checked',true);
	}
}

function defctIds(){
	var ids = "";
	$("input:[name='TPD_ID'][checked]").each(function(){   
		ids = ids+$(this).val()+",";
	});
	if (ids.length > 0){
		ids = ids.substring(0,ids.length-1);
	}
	$("#ids").val(ids);
} 

function deleteDates(){
	defctIds();
	doSubmit({actionType:'batchDelete'});
}


setRsIdTag('TPD_ID');
var ectableMenu = new EctableMenu('contextMenu','ec_table');
/* initCalendar('releaseTime','%Y-%m-%d','releaseTimePicker');
initCalendar('processTime','%Y-%m-%d','processTimePicker'); */
initCalendar('releaseTimeStart','%Y-%m-%d','releaseTimeStartPicker');
initCalendar('releaseTimeEnd','%Y-%m-%d','releaseTimeEndPicker');
initCalendar('processTimeStart','%Y-%m-%d','processTimeStartPicker');
initCalendar('processTimeEnd','%Y-%m-%d','processTimeEndPicker');

var ReleasedetailBox;
function toReleaseDetail(carId){ 
	var tpdId=$("#TPD_ID").val();
	if(ResolveddetailBox){
		PopupBox.closeCurrent();
	}
	if (!ReleasedetailBox){
		ReleasedetailBox = new PopupBox('ReleasedetailBox','缺陷发布',{size:'big',height:'335px',top:'30px'});
	}
	var url = "index?TestProjectDefectReleaseDetail&TPD_ID="+tpdId+"&operaType=inster";
	ReleasedetailBox.sendRequest(url); 
}
var ResolveddetailBox;
function openEditPage(){
	var tpdId=$("#tpdId").val()
	if(!tpdId){
		showMessage("请选中一条记录！");
		return;
	}
	var tpdState="";
	$('input[name="tpdState"]:checked').each(function(){
		tpdState=tpdState+$(this).val()+","
	});  
	var url = "index?TestProjectDefectResolvedDetail&TPD_ID="+tpdId+"&operaType=detail&tpdState="+tpdState;
	window.location.href=url; 
	//window.open(url)
}
function toResolvedDetail(carId){
	if(ReleasedetailBox){
		PopupBox.closeCurrent();
	}
	var tpdId=$("#tpdId").val()
	if(!tpdId){
		showMessage("请选中一条记录！");
		return;
	} 
	if (!ResolveddetailBox){
		ResolveddetailBox = new PopupBox('ResolveddetailBox','缺陷明细',{size:'big',height:'565px',top:'30px'});
	}
	var url = "index?TestProjectDefectResolvedDetail&TPD_ID="+tpdId+"&operaType=detail";
	ResolveddetailBox.sendRequest(url);
}
function setTpdId(tpdId){
	$("#tpdId").val(tpdId)
}

var selectFunctionBox;
function openTreeFunction(){
	 
	 var handlerId = "TestSelectFunctionTree"; 
		if (!selectFunctionBox){
			grpIdBox = new PopupBox('selectFunctionBox','请选择功能',{size:'normal',width:'300',top:'2px'});
		}
		var url = 'index?'+handlerId+'&targetId=pfIds&targetName=pfNames';
		grpIdBox.sendRequest(url);
}
function clearPfids(){
	$("#pfNames").val("");
	$("#pfIds").val("");
}
</script>
 <script>//$(function(){$(":radio[name='userName'][value="+'laosan'+"]").prop('checked', 'checked');})
 </script>
</form>
</body>
</html>
<%@include file="/jsp/inc/scripts.inc.jsp"%>
